package com.tubi.demo;

import java.util.ArrayList;
import java.util.Iterator;

public class demo1 {
    public static void main(String[] args) {
        ArrayList<Student> stArray = new ArrayList<>();
        Student s1 = new Student("ronglei",12);
        Student s2 = new Student("roglei",12);
        Student s3 = new Student("nglei",12);
        Student s4 = new Student("nglei",12);
        stArray.add(s1);
        stArray.add(s2);
        stArray.add(s3);
        stArray.add(s4);


        //迭代器
        Iterator<Student> s = stArray.iterator();
        while (s.hasNext()){
            System.out.println(s.next());
        }
        System.out.println("1111111111111");
        //for
        for (Student student : stArray) {
            System.out.println(student);
        }
        //fori
        for (int i = 0; i < stArray.size(); i++) {
            System.out.println(stArray.get(i));
        }
    }
}
